import std.stdio;

import PPath;

import std.net.curl;

import core.runtime;
import std.path;

shared static this()
{
	auto list = Runtime.args();
	if(list.length > 1){
		path = list[1];
	}
	string tpath =  dirName(list[0]);
	string abspath = absolutePath(tpath);
	info("main shared static list[0]  = ", list[0]);
	info("main shared static this path = ", path);
	info("main shared static this tpath = ", tpath);
	info("main shared static this abspath = ", abspath);
	//string appd = abspath ~ "/source/app.d";
	//path = list[0];
	//info("\nmain shared static this appd = ", appd);
	//import std.file;
	//info("\nmain shared static this appd vale =\n ", readText(appd));
}

void main()
{
	writeln("Edit source/app.d to start your project.");


	HTTP http = HTTP("http://127.0.0.1:8081/");
	http.method(HTTP.Method.post);
	string msg = "Hello world";
	http.onReceive = (ubyte[] data) {  writeln(cast(string)data); return data.length; };
	http.postData(cast(void[])msg);
	http.perform();
	writeln("--------------------do handle---------------");

	http.url("http://www.4545baidudff.com");
	http.postData(cast(void[])"fgoijpk[l;]'fguihjokpl[;['fvghjikol;'");
	http.perform();
	writeln("++++++++++++++++++++++++++=do handle---------------");


	http.url("http://www.4545baidudff.com");
	http.postData(cast(void[])"fgoijpk[l;]'fguihjokpl[;['fvghjikol;'");
	http.perform();
}

